;;;Requires a block named HOUSE with attribute tag HOUSE#
;;;
;;;Required subroutines:	UINT.LSP
;;;				ATTUPD.LSP
;;;
;;;
;;;	Author:	Henry C. Francis
;;;		425 N. Ashe St.
;;;		Southern Pines, NC 28387
;;;		http://paracadd.com
;;;		All rights reserved.
;;;
;;;		COPYRIGHT: 
;;;		   EDITED: 
;;;
(defun c:numhses ()
  (setq hse_ss (ssget "x" '((2 . "HOUSE"))))
  (setq hse_cnt 0
        hse_sslen (sslength hse_ss)
  )
  (if uint nil (load "uint" "\nFile UINT.LSP not loaded! "))
  (if attupd nil (load "attupd" "\nFile ATTUPD.LSP not loaded! "))
  (setq hse_# (uint 1 "" "Starting number for houses" (if hse_# hse_# 1)))
  (setq newvalue (ITOA hse_#))
  (while (< hse_cnt hse_sslen)
     (progn
       (setq iniblk (ssname hse_ss hse_cnt))
       (setq inient (entget iniblk))
       (setq nxtent (entget (entnext iniblk)))
       (while (/= (cdr (assoc 0 nxtent)) "SEQEND")
	 (if (eq (cdr (assoc 0 nxtent)) "ATTRIB")
	   (if (eq (strcase(cdr (assoc 2 nxtent)))(strcase "HOUSE#"))
	     (progn
	       (setq nxtent (subst (cons 1 newvalue) (assoc 1 nxtent) nxtent))
	       (entmod nxtent)
	       (entupd iniblk)
	     ) ;_ end of progn
	   ) ;_ end of if
	 ) ;_ end of if
	 (setq nxtent (entget (entnext (cdar nxtent))))
       ) ;_ end of while
       (princ)
     ) ;_ end of progn
    (SETQ hse_cnt (1+ hse_cnt)
          hse_# (1+ hse_#)
          newvalue (ITOA hse_#)
    )
  )
  (princ)
)